<?php

$menumark = 'fj';
switch ($act) {
    //#####################@ 修改分类 @#####################//
    case 'edit':
        if (isGet()) {
            $house = $db->pe_selectall('house');
            $fj = $db->pe_select('fj',array('fj_number'=>$_g_id));
            include(pe_tpl('fj_edit.html'));
        } else if (isPost()) {

            $result = $db->pe_update("fj",array('fj_number'=>$_g_id),$_p_fj);
//            mp($_p_fj);exit;
            if ($result) {
                pe_success('修改成功');
            } else {
                pe_error('修改失败');
            }
        }

        break;

    case 'del':
        $result = $db->pe_delete('fj',array('fj_number'=>$_g_id));
        if($result){
            pe_success('删除成功');
        }else{
            pe_error('删除失败');
        }


    case 'add':
        if (isGet()) {

            $house = $db->pe_selectall('house');
            include(pe_tpl('fj_add.html'));
        } else if (isPost()) {

            $result = $db->pe_insert("fj", $_p_fj);
//            mp($_p_fj);exit;
            if ($result) {
                pe_success('添加成功', 'admin.php?mod=fj&act=add');
            } else {
                pe_error('添加失败');
            }
        }

        break;
    //#####################@ 分类列表 @#####################//
    default :
        $fj = $db->sql_selectall('select fj_number,fj_houseid,house_img,house_name from wxgg_fj  join wxgg_house on wxgg_fj.fj_houseid=wxgg_house.house_id');
//        mp($fj);exit;
        include(pe_tpl('fj_list.html'));

        break;
}